package aml;

import java.io.IOException;
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.io.FileInputStream;

import aml.parse.Scanner;
import aml.parse.Parser;
import aml.parse.ParseNode;

import aml.runtime.Context;
import aml.runtime.Value;

public class Main {
	public static void main(String[] args) throws IOException {
		for (String arg : args) {
			System.out.println(">>> processing arg=" + arg);
			Scanner scanner = new Scanner(new BufferedReader(new InputStreamReader(new FileInputStream(arg))));
			Parser parser = new Parser(scanner);
			ParseNode root = parser.parse();
			Context ctx = new Context();
			Value result = root.eval(ctx);
			System.out.println(">>> result=" + result);
			System.out.println(">>> context=" + ctx);
			//System.out.println(">>> root=" + root);
			System.out.println("<<<<<<<<<<<<<<<<<<<<<<<<");
		}
	}
}